const app = getApp();
const api = require('../../utils/api.js');
const util = require('../../utils/util.js');
const {
  $Toast
} = require('../../components/base/base');


Page({

  data: {
    navBg: app.globalData.navBg,
    navColor: app.globalData.navColor,
    windowHeight: app.globalData.windowHeight - app.globalData.navHeight,
    navTop: app.globalData.navHeight,
    back: true,
    navBox: true,
    home: true,
    scrollHeight: app.globalData.windowHeight - app.globalData.navHeight,
    goTop: true,
    radioArr: [{
      name: '江南农村商业银行股份有限公司个人福利',
      checked: true
    }, {
      name: '江南农村商业银行股份有限公司个人福利',
      checked: false
    }]
  },

  scroll: function (e) {
    var that = this;
    var listIndex = (e.detail.scrollTop + this.data.screenHeight) / (this.data.screenWidth * 0.4)
    if (e.detail.scrollTop > app.globalData.navHeight + 40) {
      this.setData({
        goTop: false
      });
      this.setData({
        listIndex: listIndex
      })
    } else {
      this.setData({
        goTop: true
      });
    }

  },

  //返回顶部
  goScrolltop: function (e) {
    var that = this;
    var top = that.data.scrollTop;
    if (top == 1) {
      top = 0;
    } else {
      top = 1;
    }

    that.setData({
      scrollTop: top
    })

  },

  radio: function (e) {
    util.navigateTo('../index/index')
  },

  radioChange: function (e) {
    var radioValue = e.detail.value;
    this.setData({
      radioValue: radioValue
    });
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  }

})